import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 会议报名信息信息 */
export interface ConferenceRegistrationInformation {
  id: number // 会议报名id
  meetingId?: number // 会议id
  userId?: number // 用户id
  isFree?: number // 状态（0待审核 1已通过 2已驳回）
}

// 会议报名信息 API
export const ConferenceRegistrationInformationApi = {
  // 查询会议报名信息分页
  getConferenceRegistrationInformationPage: async (params: any) => {
    return await request.get({ url: `/biz/conference-registration-information/page`, params })
  },

  // 查询会议报名信息详情
  getConferenceRegistrationInformation: async (id: number) => {
    return await request.get({ url: `/biz/conference-registration-information/get?id=` + id })
  },

  // 新增会议报名信息
  createConferenceRegistrationInformation: async (data: ConferenceRegistrationInformation) => {
    return await request.post({ url: `/biz/conference-registration-information/create`, data })
  },

  // 修改会议报名信息
  updateConferenceRegistrationInformation: async (data: ConferenceRegistrationInformation) => {
    return await request.put({ url: `/biz/conference-registration-information/update`, data })
  },

  // 删除会议报名信息
  deleteConferenceRegistrationInformation: async (id: number) => {
    return await request.delete({ url: `/biz/conference-registration-information/delete?id=` + id })
  },

  /** 批量删除会议报名信息 */
  deleteConferenceRegistrationInformationList: async (ids: number[]) => {
    return await request.delete({
      url: `/biz/conference-registration-information/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出会议报名信息 Excel
  exportConferenceRegistrationInformation: async (params) => {
    return await request.download({
      url: `/biz/conference-registration-information/export-excel`,
      params
    })
  },

  // 审核
  audit: async (data: { id?: number; isFree?: number; rejectionReason?: string }) => {
    return await request.put({
      url: `/biz/conference-registration-information/review-meeting`,
      data
    })
  }
}
